package com.zzw.gatewayfilter.tokenfilter;

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Administrator
 */
@Configuration
public class TokenFilterConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public TokenFilter tokenFilter() {
        return new DefaultTokenFilter();
    }

    @Bean
    @ConditionalOnClass(TokenFilter.class)
    public TokenFilterGatewayFilterFactory tokenFilterGatewayFilterFactory(TokenFilter tokenFilter) {
        return new TokenFilterGatewayFilterFactory(tokenFilter);
    }
}
